import React, { Component } from "react";
import Home from "./pages/Home";
export default class App extends Component {
  state = {
    msg: "hello react",
    count: 10,
  };
  changeHandler = (e) => {
    let newVal = e.target.value;
    console.log(newVal);
    this.setState({
      msg: newVal,
    });
  };
  addCountHandler = () => {
    let count = this.state.count + 1;
    this.state.count = count;
    // this.setState({
    //   count,
    // });
  };
  render() {
    let { msg, count } = this.state;
    return (
      <div>
        <input type="text" value={msg} onChange={this.changeHandler} />
        <h2>{count}</h2>
        <button onClick={this.addCountHandler}>++</button>
        <hr />
        <Home msg={msg}></Home>
      </div>
    );
  }
}
